package com.example.algorithm.algorithmService;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.algorithm.mapper.DataInfoMapper;
import com.example.algorithm.pojo.DataInfo;
import com.example.algorithm.pojo.Department;
import com.example.algorithm.utils.AreaJudgeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.zip.CheckedOutputStream;

@Service
public class DataService {
    @Resource
    private DataInfoMapper dataInfoMapper;
    @Autowired
    private  ControlAlgorithmService controlAlgorithmService;

    public  void getData(){
        int count =0;


        QueryWrapper<DataInfo> dataInfos = new QueryWrapper<>();
        dataInfos.le("happen_date", "2021-10-31");
        dataInfos.ge("happen_date", "2021-07-01");
        //查询所有数据
        List<DataInfo> allDataInfos = dataInfoMapper.selectList(dataInfos);
        for (DataInfo dataInfo : allDataInfos) {
            Integer proposeWeight = controlAlgorithmService.getProposeWeight(dataInfo);
            Integer MainWeight = controlAlgorithmService.getMainWeight(dataInfo);


            if (!(proposeWeight > MainWeight)) {
               count += 1;
            }

        }
        System.out.println(count);
    }
}
